import request from '@/utils/axios';

interface IResponseType<P = {}> {
    code?: number;
    msg: string;
    data: P;
}

export const myPage = (formData: FormData)=>{
    return request<IResponseType>({
        url: '/exam/myPage',
        method: 'post',
        data: formData
    });
}
export const detail = (id: number)=>{
    return request<IResponseType>({
        url: '/exam/myDetail',
        method: 'get',
        params: {examId : id}
    });
}
export const submit = (formData: FormData)=>{
    return request<IResponseType>({
        url: '/exam/submitExam',
        method: 'post',
        data: formData,
        headers: {
            'Content-Type': 'application/json' // 设置默认的请求头
        }
    });
}
export const correctDetail = (id: number)=>{
    return request<IResponseType>({
        url: '/exam/detail',
        method: 'get',
        params: {examId : id}
    });
}
export default { myPage,detail,submit,correctDetail };